﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Smartec.Accounts.Camel.AMS.Model.Entities;

namespace Smartec.Accounts.Camel.AMS.Model.Repository
{
//    class DBAuditRepository
//    {
//    }
//}
    internal static class BannerRepository
    {

        internal static void AddBanner(Banner banner)
        {
            AMSObjectContextHelper.CurrentObjectContext.Banners.AddObject(banner);
        }
        internal static void Save()
        {
            AMSObjectContextHelper.CurrentObjectContext.SaveChanges();
        }
      
        internal static List<Banner> All()
        {
          return  AMSObjectContextHelper.CurrentObjectContext.Banners.ToList();
        }

        internal static void DeleteBannerById(int id)
        {
            var banner = AMSObjectContextHelper.CurrentObjectContext.Banners.FirstOrDefault(b => b.ID == id);
            if (banner != null)
            {
                AMSObjectContextHelper.CurrentObjectContext.Banners.DeleteObject(banner);
            }
        }
    }
}
